package com.wzy.activiti03;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;

import java.util.HashMap;
import java.util.Map;

/**
 * 动态设置Assignee的值
 */
public class AssigneeUEL {
    public static void main(String[] args) {
        //1.得到processEngine对象
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        //2.得到RunTimeService对象
        RuntimeService runtimeService = processEngine.getRuntimeService();
        //3.设置assignee的值 用户可以在界面上设置流程的执行人
        Map<String, Object> map = new HashMap<>();
        map.put("assignee0", "Tony马");
        map.put("assignee1", "阿克曼");
        map.put("assignee2", "吟游大诗人");
        //4.启动流程定义,同时还要设置流程定义的assignee的值
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("holiday2", map);
        //5.输出测试
        System.out.println(processEngine.getName());
    }
}
